-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: dont call spawn cb more than once on error #243
Conversation
6a58649
to
4743451
Compare
As a new release occurred today, could you fix the introduced merge conflict @dryajov ? |
4743451
to
e0fc124
Compare
@vasco-santos done - conflicts resolved. |
@@ -160,7 +161,6 @@ describe('Spawn options', function () { | |||
}) | |||
}) | |||
|
|||
// TODO ?? What is this test trying to prove? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why delete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It tries to spawn a node an then manually attach an ipfs-api to it - we do that in some places in ipfs-api tests and others...
@@ -72,6 +72,8 @@ class Node extends EventEmitter { | |||
libp2p: this.opts.libp2p | |||
}) | |||
|
|||
// TODO: should this be wrapped in a process.nextTick(), for context: | |||
// https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#why-use-process-nexttick |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do it now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking for feedback there mostly - did you take a look at the link?
src/factory-in-proc.js
Outdated
], (err) => { | ||
node.removeListener('error', errHandler) | ||
if (!called) { callback(err, node) } | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the dependency once
you also added in this PR?
@@ -92,7 +92,6 @@ | |||
"lodash.defaults": "^4.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update ipfs-repo to 0.20.0 and update all deps below 1.0.0 to be ~ rather then ^
Can I get a memory refresher on why the following error is currently happening?
|
The added test is failing, both locally and on CI
|
Just missing #243 (comment). @dryajov go ahead and pull the latest changes and apply the CR + fix the test. Then we will have CI green :) |
… ipfs-repo" This reverts commit 42597c1.
I've reverted back to using
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ipfs-repo is definitely not required as a main dependency, nor it seems that useful for tests, in fact, it might mislead the developer to think the repo was closed properly.
package.json
Outdated
@@ -86,22 +86,22 @@ | |||
"hapi": "^16.6.2", | |||
"hat": "0.0.3", | |||
"ipfs-api": "^21.0.0", | |||
"ipfs-repo": "^0.19.0", | |||
"ipfs-repo": "~0.20.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dryajov even with #243 (comment), the teardown is just used for testing. It should not be a regular dependency nor be a util from src.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diasdavid it's not only used in tests, we use it the cleanup method as well -
js-ipfsd-ctl/src/ipfsd-in-proc.js
Line 181 in b7ef098
this.repo.teardown(callback) |
AFAIK, when calling ipfs.stop()
, the repo doesn't get cleaned up, hence we need something to be able to purge it from the browsers storage (indexDB, websql, etc...), not doing that would give a false sense of the repo being cleaned up/deleted when its not, and doing it by hand would possibly lead us to deal with browser inconsistencies and other corner cases that are most likely taken care already by ipfs-repo
.
I might be missing something in my assessment, would be happy to hear otherwise 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, slight correction - seems like the only place we would need ipfs-repo
would be in
js-ipfsd-ctl/src/factory-in-proc.js
Line 144 in 21b9850
(cb) => node.repo._isInitialized(err => { |
I'll take a closer look how to better handle that piece, once thats out it should be easy to remove ipfs-repo
.
src/utils/repo/create-browser.js
Outdated
} | ||
|
||
return repo | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also based on #243 (comment), this is an antipattern. What this is creating is that IPFS might fail to close the repo and we are forcely closing it and deleting.
The only things you should need for tests are the idb.deleteDatabase
and rimraf
calls
@dryajov @diasdavid can we go forward with this to have the CI green again? |
Just missing Circle CI :) |
Hnm. Circle looks weird, I'll take a look. |
@diasdavid @vasco-santos can I get write perms so I can trigger rebuilds on circle and other CIs? |
Fine by me! But I am not able to give you permissions, at least AFAIK |
ok, circle is green. |
No description provided.